﻿<Window 
    x:Class="Wosk.LaptopKeyboardView"
  
    Title="Wosk - Laptop" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:transparent="clr-namespace:System.Windows.Controls;assembly=TransparentWindowLibrary"
    xmlns:local="clr-namespace:Wosk"
    Height="600" Width="1024" 
    Loaded="TransparentWindow_Loaded" 
    Topmost="True" 
    MouseLeftButtonDown="Button_MouseLeftButtonDown" 
    ResizeMode="NoResize"
    Background="#adde"
    Closed="TransparentWindow_Closed"
    Activated="TransparentWindow_Activated"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True">
    <!--<Window.Background>
        <VisualBrush TileMode="None" Stretch="None" AlignmentX="Left" AlignmentY="Top">
            <VisualBrush.Visual>
                <Canvas>
                    <Rectangle Mouse.MouseEnter="Rectangle_MouseEnter" Mouse.MouseLeave="Rectangle_MouseLeave" Width="100" Height="50" Fill="Red"/>
                </Canvas>
             </VisualBrush.Visual>
        </VisualBrush>
    </Window.Background>-->

    <Window.Resources>
        <local:VirtualKeyboard x:Key="virtualKeyboard" />
        <!-- used for reference to code-behind member, probably better way exists -->

        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

        <Style TargetType="{x:Type Button}"
               x:Name="Key">
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Background" Value="#ceee"/>
            <Setter Property="FontWeight" Value="Medium" />
            <!--<Setter Property="FontSize" Value="15" />-->
            <!--<Setter Property="HorizontalContentAlignment" Value="Left" />
            <Setter Property="VerticalContentAlignment" Value="Top" />-->

            <!--<Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" 
                BorderThickness="1"
                Padding="4,2" 
                BorderBrush="DarkGray" 
                CornerRadius="3" 
                Background="{TemplateBinding Background}">
                            <Grid >
                                <ContentPresenter HorizontalAlignment="Center" 
                            VerticalAlignment="Center" Name="content"/>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>-->


            <Style.Triggers>
                <!--<EventTrigger RoutedEvent="MouseEnter" >
                    <RemoveStoryboard></RemoveStoryboard>
                </EventTrigger>-->
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Background" Value="#ffff" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type Button}"
               x:Key="ShiftKey"
               BasedOn="{StaticResource {x:Type Button}}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Source={StaticResource virtualKeyboard}, Path=Shift}" Value="True">
                    <Setter Property="Background" Value="#88ABCDFF" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type Button}"
                x:Key="CtrlKey"
                BasedOn="{StaticResource {x:Type Button}}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Source={StaticResource virtualKeyboard}, Path=Ctrl}" Value="True">
                    <Setter Property="Background" Value="#88ABCDFF" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type Button}"
                x:Key="AltKey"
                BasedOn="{StaticResource {x:Type Button}}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Source={StaticResource virtualKeyboard}, Path=Alt}" Value="True">
                    <Setter Property="Background" Value="#88ABCDFF" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="{x:Type Button}"
                x:Key="WinKey"
                BasedOn="{StaticResource {x:Type Button}}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Source={StaticResource virtualKeyboard}, Path=Win}" Value="True">
                    <Setter Property="Background" Value="#88ABCDFF" />
                </DataTrigger>
            </Style.Triggers>
        </Style>



    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <CheckBox FontSize="20" IsChecked="True" x:Name="chkShowKeysHistory">Show keys history</CheckBox>
            <ListView Grid.Column="1" FontSize="26" x:Name="lstKeysHistory" Visibility="{Binding ElementName=chkShowKeysHistory, Converter={StaticResource BooleanToVisibilityConverter}, Path=IsChecked}" >
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
        </Grid>

            
    
    <Canvas Grid.Row="1" x:Name="keyboard" Margin="0,65.549,0,8">
        <Button Height="87.958" Width="65.151" Focusable="False" Click="Button_PressAndRelease" CommandParameter="ESCAPE" Content="Esc" Canvas.Top="-60"/>
        <Button Canvas.Left="74.647" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F1" Content="F1" Canvas.Top="-60"/>
        <Button Canvas.Left="142.504" Height="87.958" Width="64.466" Click="Button_PressAndRelease" CommandParameter="F2" Content="F2" Canvas.Top="-60"/>
        <Button Canvas.Left="210.363" Height="87.958" Width="64.466" Click="Button_PressAndRelease" CommandParameter="F3" Content="F3" Canvas.Top="-60"/>
        <Button Canvas.Left="278.22" Height="87.958" Width="64.466" Click="Button_PressAndRelease" CommandParameter="F4" Content="F4" Canvas.Top="-60"/>
        <Button Canvas.Left="351.733" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F5" Content="F5" Canvas.Top="-60" />
        <Button Canvas.Left="419.595" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F6" Content="F6" Canvas.Top="-60" />
        <Button Canvas.Left="488.583" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F7" Content="F7" Canvas.Top="-60" />
        <Button Canvas.Left="557.571" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F8" Content="F8" Canvas.Top="-60" />
        <Button Canvas.Left="632.218" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F9" Content="F9" Canvas.Top="-60" />
        <Button Canvas.Left="700.075" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F10" Content="F10" Canvas.Top="-60" />
        <Button Canvas.Left="767.932" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F11" Content="F11" Canvas.Top="-60" />
        <Button Canvas.Left="839.185" Height="87.958" Width="65.597" Click="Button_PressAndRelease" CommandParameter="F12" Content="F12" Canvas.Top="-60" />
        <Button Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_3" Content="~"/>
        <Button Canvas.Left="68.519" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_1" Content="1"/>
        <Button Canvas.Left="137.03" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_2" Content="2"/>
        <Button Canvas.Left="205.56" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_3" Content="3"/>
        <Button Canvas.Left="274.067" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_4" Content="4"/>
        <Button Canvas.Left="342.575" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_5" Content="5"/>
        <Button Canvas.Left="411.105" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_6" Content="6"/>
        <Button Canvas.Left="479.628" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_7" Content="7"/>
        <Button Canvas.Left="548.157" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_8" Content="8" />
        <Button Canvas.Left="616.666" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_9" Content="9"/>
        <Button Canvas.Left="685.174" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="_0" Content="0"/>
        <Button Canvas.Left="753.706" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_MINUS" Content="-"/>
        <Button Canvas.Left="822.212" Canvas.Top="35.761" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_PLUS" Content="+"/>
        <Button Canvas.Left="890.734" Canvas.Top="35.761" Height="87.95" Width="127.248" Click="Button_PressAndRelease" CommandParameter="BACK" Content="Backspace"/>
        <Button Canvas.Top="125.667" Height="87.95" Width="99.84" Click="Button_PressAndRelease" CommandParameter="TAB" Content="Tab"/>
        <Button Canvas.Left="104.048" Canvas.Top="125.667" Height="87.95" Width="71.252" Click="Button_PressAndRelease" CommandParameter="Q" Content="Q"/>
        <Button Canvas.Left="178.148" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="W" Content="W"/>
        <Button Canvas.Left="246.668" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="E" Content="E"/>
        <Button Canvas.Left="315.175" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="R" Content="R"/>
        <Button Canvas.Left="383.708" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="T" Content="T"/>
        <Button Canvas.Left="452.213" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="Y" Content="Y"/>
        <Button Canvas.Left="520.724" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="U" Content="U"/>
        <Button Canvas.Left="589.255" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="I" Content="I"/>
        <Button Canvas.Left="657.775" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="O" Content="O"/>
        <Button Canvas.Left="726.303" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="P" Content="P"/>
        <Button Canvas.Left="794.813" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_4" Content="["/>
        <Button Canvas.Left="863.316" Canvas.Top="125.667" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_6" Content="]"/>
        <Button Canvas.Left="931.854" Canvas.Top="125.667" Height="87.95" Width="86.137" Click="Button_PressAndRelease" CommandParameter="OEM_5" Content="\"/>
        <Button Canvas.Top="215.577" Height="87.95" Width="127.248" Click="Button_PressAndRelease" CommandParameter="CAPITAL" Content="Caps Lock"/>
        <Button Canvas.Left="130.244" Canvas.Top="215.577" Height="87.95" Width="71.938" Click="Button_PressAndRelease" CommandParameter="A" Content="A"/>
        <Button Canvas.Left="205.56" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="S" Content="S"/>
        <Button Canvas.Left="274.067" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="D" Content="D"/>
        <Button Canvas.Left="342.575" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="F" Content="F"/>
        <Button Canvas.Left="411.105" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="G" Content="G"/>
        <Button Canvas.Left="479.628" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="H" Content="H"/>
        <Button Canvas.Left="548.157" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="J" Content="J"/>
        <Button Canvas.Left="616.666" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="K" Content="K"/>
        <Button Canvas.Left="685.174" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="L" Content="L"/>
        <Button Canvas.Left="753.706" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_1" Content="; :"/>
        <Button Canvas.Left="822.212" Canvas.Top="215.577" Height="87.95" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_7" Content="' &quot;"/>
        <Button Canvas.Left="890.734" Canvas.Top="215.577" Height="87.95" Width="127.248" Click="Button_PressAndRelease" CommandParameter="RETURN" Content="Enter"/>
        <Button Style="{StaticResource ShiftKey}" Canvas.Top="307.137" Height="87.958" Width="156.611" Click="Button_PressAndHold" CommandParameter="LSHIFT" Content="Shift" />
        <Button Canvas.Left="161.728" Canvas.Top="307.137" Height="87.958" Width="72.383" Click="Button_PressAndRelease" CommandParameter="Z" Content="Z"/>
        <Button Canvas.Left="236.873" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="X" Content="X"/>
        <Button Canvas.Left="305.393" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="C" Content="C"/>
        <Button Canvas.Left="373.917" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="V" Content="V"/>
        <Button Canvas.Left="442.419" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="B" Content="B"/>
        <Button Canvas.Left="510.958" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="N" Content="N"/>
        <Button Canvas.Left="579.458" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="M" Content="M"/>
        <Button Canvas.Left="647.974" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_COMMA" Content=", &lt;"/>
        <Button Canvas.Left="716.5" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_PERIOD" Content=". &gt;"/>
        <Button Canvas.Left="785.021" Canvas.Top="307.137" Height="87.958" Width="65.151" Click="Button_PressAndRelease" CommandParameter="OEM_2" Content="/ ?"/>
        <Button Style="{StaticResource ShiftKey}" Canvas.Left="851.624" Canvas.Top="307.137" Height="87.958" Width="166.254" Click="Button_PressAndHold" CommandParameter="RSHIFT" Content="Shift" />
        <Button Style="{StaticResource CtrlKey}" Canvas.Top="398.899" Height="87.958" Width="113.544" Click="Button_PressAndHold" CommandParameter="LCONTROL" Content="Ctrl"/>
        <Button Style="{StaticResource WinKey}" Canvas.Left="123.334" Canvas.Top="398.899" Height="87.958" Width="86.137"  Click="Button_PressAndHold" CommandParameter="LWIN" Content="Win"/>
        <Button Style="{StaticResource AltKey}" Canvas.Left="217.316" Canvas.Top="398.899" Height="87.958" Width="117.458" Click="Button_PressAndHold" CommandParameter="MENU" Content="Alt" />
        <Button Canvas.Left="342.575" Canvas.Top="398.899" Height="87.958" Width="348.462" Click="Button_PressAndRelease" CommandParameter="SPACE" Content=" "/>
        <Button Style="{StaticResource AltKey}" Canvas.Left="698.872" Canvas.Top="398.899" Height="87.958" Width="113.544" Click="Button_PressAndHold" CommandParameter="MENU" Content="Alt" />
        <Button Canvas.Left="822.212" Canvas.Top="398.899" Height="87.958" Width="80.264" CommandParameter="LMENU" Content="Menu" />
        <Button Style="{StaticResource CtrlKey}" Canvas.Left="910.304" Canvas.Top="398.899" Height="87.958" Width="107.671" CommandParameter="RCONTROL" Content="Ctrl" Click="Button_PressAndHold"/>
        <Button Click="Button_Hide" Height="87.958" Canvas.Left="950.794" Canvas.Top="-60" Width="68.205" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" TextBlock.TextAlignment="Center"><Run Text="Hide"/></TextBlock>
                <TextBlock Grid.Row="1" TextBlock.TextAlignment="Center"><Run Text="(NumLock)"/></TextBlock>
            </Grid>

        </Button>
        <!--<CheckBox Canvas.Left="894.223" Canvas.Top="17.02" Height="16.665" Name="checkBox1" Width="17.845" IsChecked="{Binding Source={StaticResource virtualKeyboard}, Path=Shift, Mode=TwoWay, NotifyOnTargetUpdated=True}"></CheckBox>-->
    </Canvas>
    <!--<Viewbox Stretch="Fill" DockPanel.Dock="Bottom">-->
    <!--</Viewbox>-->
    </Grid>
</Window>

